GCC_BIN ?= $(shell which g++)
CARGO_BIN ?= $(shell which cargo)

gen:
	cbindgen --config cbindgen.toml -l c++ --crate ffi_opaque_struct_demo --output gen.h

run: gen clean build
	./csrc/main

clean: 
	$(CARGO_BIN) clean
	rm -f ./csrc/main

build:
	$(CARGO_BIN) build --release
	$(GCC_BIN) -Wall -o ./csrc/main ./csrc/main.cc -I . -L target/release -lffi_opaque_struct_demo
